<template>


  <div>

    <el-row>

      <el-button type="primary" size="small">查询影片</el-button>
      <el-button type="danger" size="small">删除用户</el-button>
      <el-button type="success" size="small" @click="open3">添加影片</el-button>
    </el-row>
    <el-row>

      <el-table border :data="movies" style="margin-top: 5px">
          <el-table-column
            type="selection"
            width="55">
          </el-table-column>
          <el-table-column prop="yname" label="影片名"></el-table-column>
          <el-table-column prop="dname" label="导演"></el-table-column>
        <el-table-column prop="price" label="票价"></el-table-column>
        <el-table-column prop="sdate" label="上映时间" :formatter="formatdate"></el-table-column>
        <el-table-column prop="stime" label="时长"></el-table-column>
        <el-table-column prop="ytype" label="类型"></el-table-column>
        <el-table-column prop="ndate" label="年代"></el-table-column>
        <el-table-column prop="qy" label="区域" ></el-table-column>
        <el-table-column prop="status" label="状态" ></el-table-column>


      </el-table>

          <el-pagination @size-change="sizeChangeHandler" @current-change="currentChangeHandler" :current-page="pageinfo.cpage" :page-sizes="[3,5,10,20]" :page-size="pageinfo.row" layout="total, sizes, prev, pager, next, jumper" :total="pageinfo.total"></el-pagination>
    </el-row>
  </div>

</template>

<script>

  import axios from "axios"
  export default {
    name: "UserList",
    data() {
      return {
        movies:[],
        pageinfo:{
          cpage:1,
          row:3,
          total:10
        }
      }
    },
    mounted(){
      //去后台加载数据
      var that =this;
      axios.get("/eq/movie").then(function (response) {
        that.movies=response.data;
      }).catch(function (ex) {
        //处理异常
      });

    },
    methods:{

      open3() {
        this.$prompt('请输入邮箱', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',

        }),
          this.$prompt('请输入邮箱', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',

          })
      },
      formatdate(row, column, value, index) {
        var date = new Date(value);
        return date.getFullYear() + "-" + (1 + date.getMonth()) + "-" + date.getDate()
//        return "2019-08-19"
      },

      sizeChangeHandler(size) {
        this.row = size;
        var that = this;
        axios.get("/eq/movie", {
            params: {
              row: that.row,
              cpage: that.cpage
            }
          }
        ).then(function (response) {
          that.movies = response.data;
        }).catch(function (ex) {
          //处理异常
        });

      },
      currentChangeHandler(current) {
        this.cpage = current;
        var that = this;
        axios.get("/eq/movie", {
            params: {
              row: that.row,
              cpage: that.cpage
            }
          }
        ).then(function (response) {
          that.movies = response.data;
        }).catch(function (ex) {
          //处理异常
        });
      }
    }
  }

</script>
<style>

</style>
